/**
 * Copyright &copy; 2016-2017 <a href="https://www.lczyfz.com">联创智云</a> All rights reserved.
 */
package com.lczyfz.campusinfo.modules.campusinfoorder.service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.lczyfz.campusinfo.common.enums.OrderType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lczyfz.campusinfo.common.persistence.Page;
import com.lczyfz.campusinfo.common.service.CrudService;
import com.lczyfz.campusinfo.modules.campusinfoorder.entity.CampusinfoOrder;
import com.lczyfz.campusinfo.modules.campusinfoorder.dao.CampusinfoOrderDao;

/**
 * 订单号Service
 * @author zms
 * @version 2018-05-13
 */
@Service
@Transactional(readOnly = true)
public class CampusinfoOrderService extends CrudService<CampusinfoOrderDao, CampusinfoOrder> {
	@Autowired
	public CampusinfoOrderDao campusinfoOrderDao;
	public CampusinfoOrder get(String id) {
		return super.get(id);
	}
	
	public List<CampusinfoOrder> findList(CampusinfoOrder campusinfoOrder) {
		return super.findList(campusinfoOrder);
	}
	
	public Page<CampusinfoOrder> findPage(Page<CampusinfoOrder> page, CampusinfoOrder campusinfoOrder) {
		return super.findPage(page, campusinfoOrder);
	}
	public  String getmax() {
		return campusinfoOrderDao.getmax();
	}
	@Transactional(readOnly = false)
	public void save(CampusinfoOrder campusinfoOrder) {
		super.save(campusinfoOrder);
	}
	@Transactional(readOnly = false)
	public String saveOrderCode(String orderType) {
		CampusinfoOrder campusinfoOrder = new CampusinfoOrder();
		campusinfoOrder.setSeqTag(orderType);
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHH");
		super.save(campusinfoOrder);
		String getmax =campusinfoOrderDao.getmax();
		String Stringdata = sdf.format(new Date());
		return orderType+Stringdata+getmax;
	}
	@Transactional(readOnly = false)
	public void delete(CampusinfoOrder campusinfoOrder) {
		super.delete(campusinfoOrder);
	}
	
}